Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EventService CRUD methods #767

Merged

Conversation

jeffplays2005
Copy link
Contributor

Added the following:

  • Create event
  • Get event by ID
  • Update event
  • Delete event by ID

Added the following:
* Create event
* Get event by ID
* Update event
* Delete event by ID
@jeffplays2005 jeffplays2005 linked an issue Aug 28, 2024 that may be closed by this pull request
7 tasks
Copy link

github-actions bot commented Aug 28, 2024

Visit the preview URL for this PR (updated for commit e6d0ec6):

https://uasc-ceebc--pr767-702-backend-create-a-afv7s7ud.web.app

(expires Sat, 07 Sep 2024 12:00:57 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 36296ceaed1d43e92e7d5e81a72a7bd987560bfa

Copy link
Member

@choden-dev choden-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some simple tests would be good

jeffplays2005 and others added 5 commits August 28, 2024 22:11
Removed document ID when fetching an event as realised was not needed.

Man its the timestamps again...
Includes add, get, update and delete methods.
Added tests in EventService.test.ts for sub collection, EventReservation.
Seems to work in tests so didn't need to use DateUtil
…pdate event service

Changed FirestoreCollections to 2 different collections:

* FirestoreCollection - just the general collections

* FirestoreSubcollection - collections under a "general" collection

Created individual Firestore.ts file to hold the main adapter and have the subcollection and collection import it.

Updated EventService for the subcollection changes.
The `deleteEvent` function from EventService will now delete all reservations if they exist.

Added tests to test functionalities.

1. Tests deleting all reservations under a deleted event

2. Checks if other reservations are deleted that are unrelated to a deleted event
expect(fetchedReservation2).toBe(undefined)
})

it("Should not delete other reservations when deleting an event document", async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

server/src/data-layer/adapters/Firestore.ts Show resolved Hide resolved
@jeffplays2005
Copy link
Contributor Author

jeffplays2005 commented Aug 31, 2024

Screenshot 2024-08-31 at 11 59 26 PM Added jsdoc!

@jeffplays2005 jeffplays2005 merged commit 22a93cd into master Aug 31, 2024
8 checks passed
@jeffplays2005 jeffplays2005 deleted the 702-backend-create-an-eventservice-for-crud-on-events branch August 31, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BACKEND] Create an EventService for CRUD on Events
2 participants